import { ref } from 'vue'
import request from '@/utils/request.js'

//查询章节
export const selectChapterById = (courseId) => {
    return request.get('/chapter/select?courseId=' + courseId)
}

//获取课程信息
export const getCourseById = (courseId) => {
    return request.get('/course/getCourse/' + courseId)
}

//查询课程专业方向
export const selectDirectionByCourseId = (courseId) => {
    return request.get('/direction/selectDirectionByCourseId/' + courseId)
}

//查询专业课程
export const selectProfessionalName = (courseId) => {
    return request.get('/professional/selectProfessionalName/' + courseId)
}

//查询当前课程视频时长
export const getVideoTime = (courseId) => {
    return request.get('/video/getVideoTime?courseId=' + courseId)
}

export const getChpSecListById = (courseId) => {
    return request.get('/course/chpSecList?courseId=' + courseId)
}

export const increaseChapter = (chapter) => {
    return request.post('/chapter/increaseChapter', chapter)
}

export const deleteSectionById = (sectionId) => {
    return request.delete('/section/delete?sectionId=' + sectionId)
}

export const getChapterNameById = (chapterId) => {
    return request.get('/chapter/getChapterNameById?chapterId=' + chapterId)
}

export const updateChapterNameById = (chapterId, chapterName) => {
    return request.put('/chapter/update?chapterId=' + chapterId + "&chapterName=" + chapterName)
}

export const increaseSection = (section) => {
    return request.post('/section/increaseSection', section)
}

export const deleteChapter = (chapterId) => {
    return request.delete('/course/deleteChapter?chapterId=' + chapterId)
}



export const getVideoList = (sectionId) => {
    return request.get("/video/selectVideoList/" + sectionId)
}
export const getCoursewareList = (sectionId) => {
    return request.get("/courseware/selectWareList?sectionId=" + sectionId)
}
export const getFileInfoList = (sectionId) => {
    return request.get("/FileInfo/getFileInfo?sectionId=" + sectionId)
}
export const getHomeWorkList = (sectionId) => {
    return request.get("/task/selectTaskList?sectionId=" + sectionId)
}

export const deleteVideo = (videoId) => {
    return request.delete("/video/deleteVideo?videoId=" + videoId)
}
export const deleteCourseware = (coursewareId) => {
    return request.delete("/courseware/deleteCourseware?coursewareId=" + coursewareId)
}
export const deleteFileInfo = (infoId) => {
    return request.delete("/FileInfo/deleteFileInfo?infoId=" + infoId)
}
export const deleteTask = (taskId) => {
    return request.delete("/task/deleteTask?taskId=" + taskId)
}
//删除课程
export const deleteCourse = (courseId) => {
    return request.delete("/course/deleteCourse?courseId=" + courseId)
}
//根据课程id修改课程信息
export const insertuser=(course)=>{
    return request.post("/courseware/insertuser",course)
}